package com.njust.dao;

import com.njust.bean.Employee;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface EmployeeDao {

    Employee getEmployeeById(Integer id);

    Employee getEmployeeByIdAndName(Integer id, String name);

    Employee getEmployeeByIdAndName2(@Param("id") Integer id, @Param("name") String name);


    Employee getEmployeeByIdAndName3(Map<String, Object> map);

    List<Employee> getAllEmployee();

    /**
     *     id  empname       gender  email           login_account
     ------  ------------  ------  --------------  ---------------
     1  admin              0  admin@qq.com    a
     * @param id
     * @return
     *
     * 列名作为key，值作为value
     */
    Map<String, Object> getEmployeeByIdReturnMap(Integer id);

    /**
     * key就是这个记录的主键；value就是这条记录封装好的对象；
     * @return
     *
     * 把查询的记录的id的值作为key封装这个map
     *
     * @MapKey("id")
     */
    @MapKey("id")
    Map<Integer, Employee> getAllEmpsReturnMap();

    int updateEmployee(Employee employee);

    boolean deleteEmployee(Integer id);

    boolean insertEmployee(Employee employee);

    boolean insertEmployee2(Employee employee);


}
